The invention relates to a system for expanding the program memory capability of an 8051-based microcontroller (manufactured by Intel and others) from its standard 65,536 bytes (i.e., 64 kilobytes) to 524,288 bytes (i.e., 512 kilobytes) without the need for either segment registers or memory bank registers.
The 8051 is a microcontroller that is commonly used in "embedded control" applications. (Hereinafter, the term "8051" includes any "ROMless" mode microcontroller that executes the well-known 8051 instruction set.) As the complexity of these applications continues to grow, the size of the associated program increases commensurately. Also, programmers are increasing their use of High Level languages (e.g., the languages C and PL/M-51) in programming 8051-based applications. A program written in a High Level language generally uses considerably more program memory than the same program written in Assembly language. As a result of the above two trends, it is not unusual for 8051-based systems to require significantly more than 64 kilobytes of program memory.
The 8051 was designed with a 16-bit Program Counter, which limits the size of its program memory to 64 kilobytes. While some microprocessors have embedded therein segment registers to extend the size of their program memory, the 8051 makes no such provisions. 8051 programs larger than 64 kilobytes can only be accommodated by using what is commonly called "memory bank switching" techniques. Memory bank switching uses a dedicated register completely independent of the 8051 program counter to extend the number of program memory address bits. Memory bank switching requires the programmer to break down his program into sections that can fit completely within a bank of 64 kilobytes. The programmer also has to ensure that the bank register is loaded properly as the program transitions from one 64 kilobyte bank to another.
While the memory bank switching technique is simple in concept and offers the potential of supporting a large program memory size, it suffers from many severe deficiencies. Some of the major deficiencies are itemized below:
(1) Since the instruction for loading of the memory bank register is a separate operation from a program jump instruction, either the program must be fine tuned to take into account the sudden transition to another memory bank or else costly external hardware must be provided to synchronize the loading of the new memory bank to the instruction stream.
(2) In order to execute a subroutine call to another bank, the programmer has to be very careful that the current memory bank value is saved on the call, that the hardware synchronizes the loading of the new memory bank to the instruction stream, that the previous memory bank value is restored on return, and again that the memory bank value is synchronized to the instruction stream.
(3) The program must be designed to make special provision for handling interrupts since interrupts are an integral part of the 8051 device and are therefore completely independent of any memory bank switching algorithm the programmer may be using.
(4) At each 64 kilobyte boundary there is a forbidden zone that cannot be used. This forbidden zone prevents instructions from straddling two 64 kilobyte memory banks, as well as preventing relative jumps from executing either forward or backward offsets across a 64 kilobyte boundary.
(5) Since there is no standard method of implementing memory bank switching, every programmer is free to use any number of methods. As a result, it is difficult to find development tools that support memory bank switching methods, thus increasing the difficulty in debugging the application and complicating the design effort.
In summary, due to the special processing and handling required, use of memory bank switching in an 8051-based application typically slows down the program execution, increases hardware costs and increases the cost of software being developed.
There is a need to be able to expand the program memory for the 8051 microcontroller from 64 kilobytes to 512 kilobytes while eliminating the problems associated with memory bank switching.